<!DOCTYPE html>
<html lang="en">
<head>
    <title>商品详情</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="/bootstrap/css/bootstrap.min.css" /><!-- bootstrap -->
    <script type="text/javascript" src="/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/jquery-validation/jquery.validate.min.js"></script> <!-- jquery-validator -->
    <script type="text/javascript" src="/jquery-validation/localization/messages_zh.min.js"></script>
    <script type="text/javascript" src="/layer/layer.js"></script><!-- layer -->
    <script type="text/javascript" src="/js/md5.min.js"></script><!-- md5.js -->
    <script type="text/javascript" src="/js/common.js"></script><!-- common.js -->
</head>
<body>
<div class="panel panel-default"  style="height:100%;background-color:rgba(222,222,222,0.8)">
    <div class="panel-heading">秒杀订单详情</div>
    <table class="table" id="goodslist">
        <tr>
            <td>商品名称</td>
            <td colspan="3" id="goodName"></td>
        </tr>
        <tr>
            <td>商品图片</td>
            <td colspan="2"><img id="goodImg" width="200" height="200" /></td>
        </tr>
        <tr>
            <td>订单价格</td>
            <td colspan="2" id="seckillPrice"></td>
        </tr>
        <tr>
            <td>下单时间</td>
            <td id="createDate" colspan="2"></td>
        </tr>
        <tr>
            <td>订单状态</td>
                <td class="status0" style="display: none">
                    未支付
                    <button class="btn btn-primary btn-block" type="submit" id="payButton">立即支付</button>
                </td>
                <td class="status1" style="display: none">
                    已支付
                </td>

        </tr>
        <tr>
            <td>收货人</td>
            <td colspan="2">叩丁狼  13088889999</td>
        </tr>
        <tr>
            <td>收货地址</td>
            <td colspan="2">广州市天河区棠下街道涌东路大地商务港603</td>
        </tr>
    </table>
</div>
<script>
    var orderNo;
    $(function () {
        orderNo = getQueryString("orderNo");
        if(!orderNo){
            layer.msg("操作有误");
            return;
        }
        getOrderInfo(orderNo);
    })
    function getOrderInfo(orderNo) {
        $.ajax({
            url:'/seckill/to_orderInfo?orderNo='+orderNo,
            type:'GET',
            success:function (data) {
                if(data.code == 200){
                    render(data.data);
                }else{
                    layer.msg(data.data);
                }
            },
            error:function () {
                layer.msg("客户端调用异常");
            }
        })
    }
    function render(orderInfo) {
        $("#goodName").html(orderInfo.goodName);
        $("#goodImg").prop("src",orderInfo.goodImg);
        $("#seckillPrice").html(orderInfo.seckillPrice);
        $("#createDate").html(orderInfo.createDate);
        $(".status"+orderInfo.status).show();
    }
</script>
</body>
</html>
